Skip to main content

All Questions

2votes
3answers
262views

Mapping words to letters which contains

Given sentence for example: ala ma kota, kot koduje w Javie kota I should to every letter occurring in the sentence I should map every string that this letter ...
mara122's user avatar
5votes
3answers
6kviews

Generating all possible combinations of a string using iteration

I am generating all possible combinations from a string concatenated. I have a \$O(n*2^n)\$ solution. ...
Gary In's user avatar
1vote
1answer
130views

Producing residues of combinatorics on strings

Basically, this code does multiplication of chosen operations. ...
user avatar
2votes
1answer
838views

Efficient String permutations calculation in Java

In trying to compute permutations of a given String, what can I do to further improve the code below for memory and/or time efficiency? ...
Anonymous Human's user avatar
2votes
1answer
2kviews

Iterative solution for generating all permutations of a string

I know the runtime for generating all permutations is supposed to be \$O(n!)\$. I'm not sure if the code I wrote for it runs in \$O(n!)\$ though. I'm having trouble analyzing its runtime. The ...
fluffychaos's user avatar
3votes
2answers
3kviews

Non-Contiguous Substrings

Problem: A non-contiguous substring of string \$s\$ is a sequence of \$k \geq 0\$ characters in \$s\$, in the order in which they occur in \$s\$. For instance, the set of all non-contiguous ...
francium's user avatar
2votes
1answer
828views

Generate all possible permutations from a string with character repetitions

I want to know if my code is good, with reasonable efficiency, and if it is possible to improve my code and how. What would you suggest? ...
YohanRoth's user avatar
10votes
2answers
449views

You need to diversify your strings

Challenge: Write a program which prints all the permutations of a string in alphabetical order. Specifications: Your program should accept a file as its first argument. The file contains input ...
Legato's user avatar
  • 9,839
1vote
1answer
448views

Permutations of a string

I wrote the following code to permute the characters of a string assuming there is no repeated character. I also want to make sure the space complexity of this algorithm is \$O(n*n!)\$: There are \$...
giulio's user avatar
4votes
1answer
154views

String manipulations (reverse a string by characters, permutation)

I'm trying to solve simple Java problems in various ways. Could anyone comment about the code, like how it could be better, and what could be a problem? ...
poppoppushpop's user avatar
9votes
2answers
775views

Optimizing String combinations in Java

I need to obtain all combinations of a String of length k from the given elements. For example, for ...
user1418018's user avatar
3votes
3answers
10kviews

Permutation of a string eliminating duplicates

This code lists the permutations of the string, and eliminates duplicates if any. I'm looking for code review, best practices, optimizations etc. I'm also verifying complexity: \$O(n! * n)\$ as time ...
JavaDeveloper's user avatar
6votes
3answers
89kviews

Calculate all possible combinations of given characters

I was asked in my textbook Lectures on Discrete Mathematics for Computer Science to construct a program that would take an alphabet ({a,b,c} or any combination of ...
user avatar
3votes
2answers
186views

Determine if a word can be constructed from list of subsets - follow-up

I have reworked my code as suggested from my previous question: Determine if a word can be constructed from list of subsets. Please instruct me on the complexity along with a review feedback, as ...
JavaDeveloper's user avatar
2votes
2answers
193views

Determine if a word can be constructed from list of subsets [closed]

The question is explained well by examples in the comments below. Also I request verifying complexity: O( n * n!), where n is the number of words in the subsets. Review my code for optimizations, ...
JavaDeveloper's user avatar

153050per page
close